﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BioWeb.movieservice;
using BioWeb.cinemahallservice;
using BioWeb.showservice;


namespace BioWeb
{
    public partial class ManageShows : System.Web.UI.Page
    {
        movieservice.MovieService movies;
        cinemahallservice.CinemaHallService cinemahalls;
        showservice.ShowService shows;

        protected void Page_Load(object sender, EventArgs e)
        {
            movies = new movieservice.MovieService();
            cinemahalls = new cinemahallservice.CinemaHallService();
            shows = new showservice.ShowService();
            populateLists();

        }
        private void populateLists()
        {
            movielist.Items.Clear();
            chlist.Items.Clear();
            showlist.Items.Clear();
            foreach (movieservice.Movie m in movies.FindAllMovies())
            {
                movielist.Items.Add(m.title);
            }
            foreach (cinemahallservice.CinemaHall h in cinemahalls.FindAllCinemaHalls())
            {
                chlist.Items.Add(h.name);
            }
            foreach (showservice.Show s in shows.FindAllShows(true,true))
            {
                showlist.Items.Add("Film: " + s.movie.title + " Sal: " + s.cinemaHall.name + " Starter: " + s.dateTimeStart + " Slutter: " + s.dateTimeEnd + " Pris: " + s.pricePerTicket);
            }
        }
    }
}